const express = require('express');
const app = express();

const bodyParser = require("body-parser");

// 开放路径
app.use('/', express.static('./'))

// 模板引擎
app.engine('html', require('express-art-template'));

// body-praeser(必须要在挂载路由之前)
app.use(bodyParser.urlencoded({ extended: true }));
app.use(bodyParser.json());

// 路由部分
const router = require('./router.js');
app.use(router);

app.listen('3000', () => {
    console.log('http://localhost:3000')
})

/** 
// 使用回调函数来执行异步操作
function fn(callback){
    // var callback = (a) => { console.log(a) }
    setTimeout(() => {
        var a = '测试'
        callback(a)
    }, 1000)
}
fn((e) => {
    console.log(e)
}) 
*/

// cd existing_git_repo
// git remote add origin https://gitee.com/yejunm3/crudexpress.git
// cd existing_git_repo